package top.huhuiyu.springboot3.p2301.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Optional;

@Controller
public class IndexController {
    @RequestMapping("")
    public String index(String name, Model model) {
        name = Optional.ofNullable(name).orElse("黑暗骑士");
        model.addAttribute("name", name);
        return "index";
    }
}
